package ${pkg};

import java.util.List;
import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.blue.jdbc.JdbcDataSource;
import com.blue.jdbc.Page;

import ${daoPkg}.${clazz}Dao;
import ${modelPkg}.${clazz};
<#if impList??>
<#list impList as vo>
import ${vo};
</#list>
</#if>

/**
 * ${name}业务层
 * 
 * @author 代码由 blue-code 框架生成
 * @since 1.0 ${.now?string("yyyy年MM月dd日")}
 */
@Service
@Transactional
public class ${clazz}Service
{
	@Resource
	private ${clazz}Dao ${field}Dao;
	
	public ${clazz}Service()
	{
	}
	
	public ${clazz} save(${clazz} ${field})
	{
		if (${field}.getId() == null)
		{
			${field}Dao.save(${field});
		}
		else
		{
			${field}Dao.update(${field});
		}
		${clazz} a = ${field}Dao.get(${field}.getId());
		return a;
	}
	
	public ${clazz} get(Integer id)
	{
		${clazz} log = ${field}Dao.get(id);
		return log;
	}
	
	public Page<${clazz}> list(${clazz} ${field}, Page<${clazz}> page)
	{
		page = ${field}Dao.list(${field}, page);
		return page;
	}
	
	public List<${clazz}> list(${clazz} ${field})
	{
		List<${clazz}> list = ${field}Dao.list(${field});
		return list;
	}
	
	public void delete(${clazz} ${field})
	{
		${field}Dao.delete(${field});
	}
	
}
